package cn.com.css.taxInspection.common.job.task;



import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

import cn.com.css.taxInspection.common.constants.Constants;
import cn.com.css.taxInspection.gt3.entity.JcLsfxMxEntity;
import cn.com.css.taxInspection.gt3.service.JcLsfxMxService;
import cn.com.css.taxInspection.gt3.service.JcSjlService;
import cn.com.css.taxInspection.util.TsBqUtils;
import cn.com.css.taxInspection.workflow.constants.WorkflowConstants;
import cn.com.css.taxInspection.workflow.entity.WorkflowInspectionHearEntity;
import cn.com.css.taxInspection.workflow.service.WorkflowInspectionHearService;
import cn.com.css.taxInspection.workrisk.entity.WorkriskRisk1Entity;
import cn.com.css.taxInspection.workrisk.service.WorkriskControlService;
import cn.com.css.taxInspection.workrisk.service.WorkriskRisk1Service;

/**
 * 主管局长同意案卷报审后案卷返回检查人员，返回当天提示案卷尽快提审，连续提示三天。
 *
 * @author shaochangyang
 * @version V1.0
 * @date 2020年3月18日
 */
@Component("risk1Task2")
public class Risk1Task2 {
	private Logger logger = LoggerFactory.getLogger(getClass());
	
	@Resource
	private WorkflowInspectionHearService workflowInspectionHearService;
	
	@Resource
	private WorkriskRisk1Service workriskRisk1Service;
	
	@Resource
	private WorkriskControlService workriskControlService;
	
	@Resource
	private JcLsfxMxService jcLsfxMxService;
	
	public void run(String params) {
		
		LambdaQueryWrapper<WorkflowInspectionHearEntity> queryWrapper = Wrappers.lambdaQuery();
		queryWrapper.eq(WorkflowInspectionHearEntity::getStateCode, WorkflowConstants.INSPECT_14);
		List<WorkflowInspectionHearEntity> list = workflowInspectionHearService.list(queryWrapper);
		
		for (WorkflowInspectionHearEntity inspectionHear : list) {
			String jcry = inspectionHear.getInspectionMan11();
			
			WorkriskRisk1Entity workriskRisk1Entity = new WorkriskRisk1Entity();
			
			workriskRisk1Entity.setId(TsBqUtils.getUUID());
			workriskRisk1Entity.setRelevance(inspectionHear.getId());

			// workriskRisk1Entity.setStateCode(stateCode);
			// workriskRisk1Entity.setStateName();
			workriskRisk1Entity.setRiskType("2");
			workriskRisk1Entity.setRiskName("提醒");
			workriskRisk1Entity.setRiskMan1(jcry);
			workriskRisk1Entity.setDetails("主管局长同意案卷报审后案卷返回检查人员，返回当天提示案卷尽快提审，连续提示三天");
			workriskRisk1Entity.setTaxorgcode(inspectionHear.getInspectionTaxorg11());
			workriskRisk1Entity.setDeleted(Constants.DATA_NOT_DELETED);
			workriskRisk1Entity.setCreateTime(new Date());
			workriskRisk1Entity.setCreateId("sysJob");
			
			workriskRisk1Service.save(workriskRisk1Entity);
			
		}
		
	}

}
